package org.fisco.bcos.asset.controller;


import java.math.BigInteger;
import java.util.List;

import org.fisco.bcos.asset.client.CharityDonationClient;
import org.fisco.bcos.asset.resp.PendingProject;
import org.fisco.bcos.asset.service.RegulatorService;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/regulator")
public class RegulatorController {

    @Autowired
    private RegulatorService regulatorService;

    @Resource
    private CharityDonationClient client;
    // 审批项目
    @PostMapping("/project/{projectId}/approve")
    public void approveProject(@PathVariable BigInteger projectId) {
        regulatorService.approveProject(projectId);
    }
    // 审批项目
    @GetMapping("/project/getPendingProjects")
    public List<PendingProject> getPendingProjects() throws ContractException {
        return  client.getPendingProjects();
    }
}